package cn.com.infohold.smartcity.activity.Landinfo;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import java.io.Serializable;

import cn.com.infohold.smartcity.R;
import cn.com.infohold.smartcity.api.bean.LandInfoBean;
import cn.com.infohold.smartcity.parent.ParentActivity;
import common.annotation.ViewInject;

/**
 * Created by Monsoon on 2017/11/8.
 */
public class LandInfoDetail_Activity extends ParentActivity{

    @ViewInject(R.id.ib_back)
    ImageButton ib_back;
    @ViewInject(R.id.tv_title)
    TextView tv_title;
    @ViewInject(R.id.tv_landid)
    TextView tv_landid;
    @ViewInject(R.id.tv_name)
    TextView tv_name;
    @ViewInject(R.id.tv_contractarea)
    TextView tv_contractarea;
    @ViewInject(R.id.tv_area)
    TextView tv_area;
    @ViewInject(R.id.tv_purpose)
    TextView tv_purpose;
    @ViewInject(R.id.tv_qualitygrade)
    TextView tv_qualitygrade;
    @ViewInject(R.id.tv_landtype)
    TextView tv_landtype;
    @ViewInject(R.id.tv_bgcode)
    TextView tv_bgcode;
    @ViewInject(R.id.tv_manager)
    TextView tv_manager;
    @ViewInject(R.id.tv_farmland)
    TextView tv_farmland;
    @ViewInject(R.id.tv_easttill)
    TextView tv_easttill;
    @ViewInject(R.id.tv_westtill)
    TextView tv_westtill;
    @ViewInject(R.id.tv_southtill)
    TextView tv_southtill;
    @ViewInject(R.id.tv_northtill)
    TextView tv_northtill;
    @ViewInject(R.id.tv_remark)
    TextView tv_remark;

    private LandInfoBean landInfo;

    @Override
    protected Object inflateView() {
        return R.layout.activity_land_detail;
    }

    @Override
    protected void initView(View anchor) {

        Intent intent = getIntent();
        Bundle land_bundle = intent.getBundleExtra("land_bundle");
        if (land_bundle != null){
            landInfo = (LandInfoBean) land_bundle.getSerializable("land_detail");

            tv_title.setText(landInfo.getName());
            tv_name.setText(landInfo.getName());
            tv_contractarea.setText(landInfo.getContractarea());
            tv_area.setText(landInfo.getArea());
            tv_purpose.setText(landInfo.getPurpose());
            tv_qualitygrade.setText(landInfo.getQualitygrade());
            tv_landtype.setText(landInfo.getLandtype());
            tv_bgcode.setText(landInfo.getBgcode());
            tv_manager.setText(landInfo.getManager());
            switch (landInfo.getFarmland()){
                case 1:
                    tv_farmland.setText("是");
                    break;
                case 2:
                    tv_farmland.setText("不是");
                    break;
                default:
                    break;
            }
            tv_easttill.setText(landInfo.getEasttill());
            tv_westtill.setText(landInfo.getWesttill());
            tv_southtill.setText(landInfo.getSouthtill());
            tv_northtill.setText(landInfo.getNorthtill());
            tv_remark.setText(landInfo.getRemark());
        }

        ib_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                overridePendingTransitionFade();
            }
        });

    }


}
